/*
 * Copyright 1999-2018 Alibaba Group Holding Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.ouwen.smartpay.service.chain.slotchain;


import com.ouwen.smartpay.service.chain.context.Context;

/***
 *@author <a href="http://youngitman.tech">青年IT男</a>
 *@version v1.0.0
 *@className ProcessorSlot
 *@description Slot处理器
 *@JunitTest: {@link  }
 *@date 11:10 2020-04-22
 *
 **/
public interface ProcessorSlot<T> {
    /**
     * Entrance of this slot.
     *
     * @param context current {@link Context}
     * @param param   generics parameter
     * @param args    parameters of the original call
     * @throws Throwable blocked exception or unexpected error
     */
    void entry(Context context, T param, Object... args) throws Throwable;

    /**
     * Means finish of {@link #entry(Context, Object, Object...)}.
     *
     * @param context current {@link Context}
     * @param obj     relevant object (e.g. Node)
     * @throws Throwable blocked exception or unexpected error
     */
    void fireEntry(Context context, Object obj,
                   Object... args) throws Throwable;

    /**
     * Exit of this slot.
     *
     * @param context current {@link Context}
     * @param args    parameters of the original call
     */
    void exit(Context context, Object... args);

    /**
     * Means finish of {@link #exit(Context, Object...)}.
     *
     * @param context current {@link Context}
     * @param args    parameters of the original call
     */
    void fireExit(Context context, Object... args);
}
